package com.itany.boot.service.impl;

import com.itany.boot.dao.UserDao;
import com.itany.boot.entity.User;
import com.itany.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class UserServiceImpl implements UserService {

    // 在Springboot中,配置了MyBatis扫包操作之后
    // 此处仍然会显示编译报错,但是是由于IDEA的问题引发
    // 而并不是代码原因,因此,可以无视
    // 如果你是一个强迫症患者,请添加required属性
    @Autowired(required = false)
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.selectAll();
    }
}
